﻿#region Legal

// Jimmy Zimmerman
// Team Mongoose
//
// END USER LICENSE AGREEMENT
// IMPORTANT - READ THIS CAREFULLY:  This End User License Agreement is a legal agreement
// between you (either an individual, business entity, currently active identity of an
// individual with Multiple Personality Disorder, octopus overlord, or otherworldly entity),
// and Team Mongoose, for the enclosed, components.
//
// By reading this document and/or installing this product, you agree to be bound by the
// terms of this EULA.
//
// Team Mongoose owns all copyright, trade secret, trademark, trade wars,
// patent, portent, and potential rights to these components.  Team Mongoose
// grants you the right to deploy the enclosed components.
//
// If you agree to the terms of this EULA, a license to use these components is granted to you.
//
// If you should happen to benefit from the enclosed components, then you are legally and
// contractually bound to thank us for it. Send your regards to jimmyzimms@hotmail.com.
//
// OTHER RIGHTS AND LIMITATONS
// You may not reverse-engineer, decompile, decode, disassemble, psycho-analyze, or otherwise
// attempt to find hidden meanings between the lines of this EULA; unless, of course, you should
// happen to find some, and they are funny.
//
// You may not translate this EULA or any part of the components into Ancient Sumerian.
//
// THESE COMPONENTS ARE PROVIDED “AS-IS” WITHOUT WARRANTY OF ANY KIND. ANY USE OF THE COMPONENTS
// CONTAINED IS AT YOUR OWN RISK. TEAM MONGOOSE DISCLAIM ALL WARRANTIES, EITHER
// EXPRESS OR IMPLIED, WITH RESPECT TO THE ACCURRACY AND CORRECTNESS OF THE COMPONENTS CONTAINED
// HEREIN. TEAM MONGOOSE DOES NOT WARRANT THAT THE COMPONENTS ARE FLAWLESS.
//
// REDISTRIBUTION AND USE IN SOURCE AND BINARY FORMS, WITH OR WITHOUT MODIFICATION, ARE PERMITTED
// PROVIDED THAT THE FOLLOWING CONDITIONS ARE MET:
// * REDISTRIBUTIONS OF SOURCE CODE MUST RETAIN THE ABOVE COPYRIGHT NOTICE
// * REDISTRIBUTIONS IN BINARY FORM MUST NOTE THE USE OF THE COMPONENT IN DOCUMENTATION AND/OR
//   OTHER MATERIALS PROVIDED WITH THE DISTRIBUTION.
// * NEITHER THE NAME OF TEAM MONGOOSE MAY BE USED TO ENDORES OR PROMOTE PRODUCTS
//   DERIVED FROM THIS SOFTWARE WITHOUT SPECIFIC PRIOR WRITTEN PERMISSION.
//
// IN NO EVENT SHALL TEAM MONGOOSE BE HELD LIABLE FOR INCIDENTAL, SPECIAL, INDIRECT,
// INCONSEQUENTIAL, UNBELIEVABLE, EXAGGERATED, VERBOSE, OR TYPICAL DAMAGES INCURRED WHILE USING
// THE ENCLOSED COMPONENTS.
//
// OUR STUFF ALWAYS WORKS - SOMETIMES.

#endregion

using System;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Roller
{
    public class MainViewModel : INotifyPropertyChanged
    {
        public MainViewModel()
        {
            this.Items = new ObservableCollection<ItemViewModel>();
        }

        /// <summary>
        /// A collection for ItemViewModel objects.
        /// </summary>
        public ObservableCollection<ItemViewModel> Items
        {
            get;
            private set;
        }

        private string _sampleProperty = "Sample Runtime Property Value";
        /// <summary>
        /// Sample ViewModel property; this property is used in the view to display its value using a Binding
        /// </summary>
        /// <returns></returns>
        public string SampleProperty
        {
            get
            {
                return _sampleProperty;
            }
            set
            {
                if ( value != _sampleProperty )
                {
                    _sampleProperty = value;
                    NotifyPropertyChanged( "SampleProperty" );
                }
            }
        }

        public bool IsDataLoaded
        {
            get;
            private set;
        }

        /// <summary>
        /// Creates and adds a few ItemViewModel objects into the Items collection.
        /// </summary>
        public void LoadData()
        {
            // Sample data; replace with real data
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime one",
                LineTwo = "Maecenas praesent accumsan bibendum",
                LineThree = "Facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime two",
                LineTwo = "Dictumst eleifend facilisi faucibus",
                LineThree = "Suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime three",
                LineTwo = "Habitant inceptos interdum lobortis",
                LineThree = "Habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime four",
                LineTwo = "Nascetur pharetra placerat pulvinar",
                LineThree = "Ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime five",
                LineTwo = "Maecenas praesent accumsan bibendum",
                LineThree = "Maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime six",
                LineTwo = "Dictumst eleifend facilisi faucibus",
                LineThree = "Pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime seven",
                LineTwo = "Habitant inceptos interdum lobortis",
                LineThree = "Accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime eight",
                LineTwo = "Nascetur pharetra placerat pulvinar",
                LineThree = "Pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime nine",
                LineTwo = "Maecenas praesent accumsan bibendum",
                LineThree = "Facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime ten",
                LineTwo = "Dictumst eleifend facilisi faucibus",
                LineThree = "Suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime eleven",
                LineTwo = "Habitant inceptos interdum lobortis",
                LineThree = "Habitant inceptos interdum lobortis nascetur pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime twelve",
                LineTwo = "Nascetur pharetra placerat pulvinar",
                LineThree = "Ultrices vehicula volutpat maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime thirteen",
                LineTwo = "Maecenas praesent accumsan bibendum",
                LineThree = "Maecenas praesent accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime fourteen",
                LineTwo = "Dictumst eleifend facilisi faucibus",
                LineThree = "Pharetra placerat pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime fifteen",
                LineTwo = "Habitant inceptos interdum lobortis",
                LineThree = "Accumsan bibendum dictumst eleifend facilisi faucibus habitant inceptos interdum lobortis nascetur pharetra placerat"
            } );
            this.Items.Add( new ItemViewModel()
            {
                LineOne = "runtime sixteen",
                LineTwo = "Nascetur pharetra placerat pulvinar",
                LineThree = "Pulvinar sagittis senectus sociosqu suscipit torquent ultrices vehicula volutpat maecenas praesent accumsan bibendum"
            } );

            this.IsDataLoaded = true;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged( String propertyName )
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if ( null != handler )
            {
                handler( this, new PropertyChangedEventArgs( propertyName ) );
            }
        }
    }
}